<!-- 编辑教育局 -->
<template>
  <div class="page-box h100 display-flex czbj">
    <!-- <p class="title-label mb10">基本信息</p> -->
    <div class="pr20">
      <div class="xcxretr4xrt">
        <div class="display-flex mt20">
          <div class="xcxcdsrey vertical-center tr">所在区域:</div>
          <div class="flex-1">
            {{ dmxcxzdf(formData.qyId) }}
          </div>
        </div>

        <div class="display-flex mt20">
          <div class="xcxcdsrey vertical-center tr">教育局名称:</div>
          <div class="flex-1">
            {{ formData.title }}
            <!-- <n-input
              v-model:value="formData.title"
              type="text"
              placeholder="请输入教育局名称"
            /> -->
          </div>
        </div>
        <div class="display-flex mt20">
          <div class="xcxcdsrey vertical-center tr">负责人电话:</div>
          <div class="flex-1">
            {{ formData.phone }}
            <!-- <n-input
              v-model:value="formData.phone"
              type="text"
              placeholder="请输入教育局名称"
            /> -->
          </div>
        </div>
        <div class="display-flex mt20">
          <div class="xcxcdsrey vertical-center tr">负责人姓名:</div>
          <div class="flex-1">
            <n-input
              v-model:value="formData.name"
              type="text"
              placeholder="请输入教育局名称"
            />
          </div>
        </div>
        <div class="display-flex mt20">
          <div class="xcxcdsrey tr">登录密码:</div>
          <div class="flex-1">
            <n-input
              v-model:value="formData.paw"
              type="text"
              placeholder="请输入登录密码"
            />

            <div class="mt20">
              <n-button type="primary" @click="baocunsdr" class="xcxzcdstt">
                保存
              </n-button>

              <n-popconfirm @positive-click="tuichusdr">
                <template #trigger>
                  <n-button type="error" class="xcxzcdstt ml20">
                    退出登录
                  </n-button>
                </template>
                确认退出登录吗？
              </n-popconfirm>
            </div>
          </div>
        </div>
        <!-- <div class="display-flex mt20">
          <div class="xcxcdsrey tr">封面:</div>
          <div class="flex-1">
            <div class="headPortrait-box vertical-center sz">
              <img :src="formData.cover" v-if="formData.cover" />
              <i class="iconfont dx-tupian fz30" v-else> </i>
            </div>

            <div class="mt20">
              <n-button type="primary" @click="baocunsdr" class="xcxzcdstt">
                保存
              </n-button>

              <n-popconfirm @positive-click="tuichusdr">
                <template #trigger>
                  <n-button type="error" class="xcxzcdstt ml20">
                    退出登录
                  </n-button>
                </template>
                确认退出登录吗？
              </n-popconfirm>
            </div>
          </div>
        </div> -->
      </div>
    </div>
  </div>
</template>
<script lang="ts" setup>
import { ref } from "vue";
import dxmap from "../../../components/util/dxmap.vue";
import { dxget, dxpost, hf } from "../../../util/index";
const xmlxSelect = ref([]);
const ismaps = ref(false);
const formData = ref({});
const jyjid = localStorage.jyjid;
if (!jyjid) {
  hf("cloading");
}
const showModal = ref(false);
const successmap = (data) => {
  formData.value.adds = data.dikjxzx;
  ismaps.value = false;
};
// 获取字典内容
const xtgxxmfl = async () => {
  const { data }: any = await dxget("dxgjAdmin/getzd", { name: "dzkhqy" });
  xmlxSelect.value = data;
  console.log(data);
};

const initdata = async () => {
  await xtgxxmfl();
  const { data }: any = await dxget(
    "courseManagement/educationBureau/educationBureau",
    {
      id: jyjid,
    }
  );
  formData.value = data;
  localStorage.qyId = data.qyId;
};
initdata();

const dmxcxzdf = (data) => {
  try {
    return xmlxSelect.value.filter((a) => a.value == data)[0].label;
  } catch (e) {
    return "-";
  }
};
const baocunsdr = async () => {
  const { data }: any = await dxpost(
    "courseManagement/educationBureau/educationBureau",
    formData.value,
    "put"
  );
  window.$message.success("保存成功");
};
const tuichusdr = (data) => {
  console.log(data);
  localStorage.removeItem("qyId");
  localStorage.removeItem("jyjid");
  hf("cloading");
};
</script>
<style scoped>
.xcxcdsrey {
  width: 120px;
  text-align: right;
  padding-right: 10px;
}
.xcxretr4xrt {
  width: 600px;
}
.xcxzcdstt {
  min-width: 100px;
  font-size: 18px;
}
</style>
